package com.lmx.api.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.lmx.api.common.ErrorCode;
import com.lmx.api.exception.BusinessException;
import com.lmx.api.mapper.UserInterfanceInfoMapper;
import com.lmx.commen.model.entity.UserInterfanceInfo;
import com.lmx.api.service.UserInterfanceInfoService;
import org.springframework.stereotype.Service;

/**
* @author lmx
* @description 针对表【user_interfance_info(用户接口信息表)】的数据库操作Service实现
* @createDate 2023-02-05 11:47:47
*/
@Service
public class UserInterfanceInfoServiceImpl extends ServiceImpl<UserInterfanceInfoMapper, UserInterfanceInfo>
    implements UserInterfanceInfoService {

    @Override
    public void validInterfanceInfo(UserInterfanceInfo userInterfanceInfo, boolean b) {
        if (userInterfanceInfo.getUserid()!=null && userInterfanceInfo.getUserid()<=0){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"用户id错误");
        }
        if (userInterfanceInfo.getIntrefanceid()!=null && userInterfanceInfo.getIntrefanceid()<=0){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"接口id错误");
        }

        if (userInterfanceInfo.getTotalnum()!=null && userInterfanceInfo.getTotalnum()<=0){
            throw new BusinessException(ErrorCode.PARAMS_ERROR,"用户分配接口数量错误");
        }



    }
}




